﻿using UnityEngine;
using UnityEditor;
using UnityEngine.UI;

[CustomEditor(typeof(AudioStudio.DropdownSound)), CanEditMultipleObjects]
public class DropdownSoundInspector : Editor
{
    AudioStudio.DropdownSound component;

    void OnEnable()
    {
        component = target as AudioStudio.DropdownSound;
    }

    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        EditorGUILayout.LabelField("ValueChangeEvents:");
        AudioScriptGUI.DrawList(serializedObject.FindProperty("ValueChangeEvents"));
        EditorGUILayout.LabelField("PopupEvents:");
        AudioScriptGUI.DrawList(serializedObject.FindProperty("PopupEvents"));
        EditorGUILayout.LabelField("CloseEvents:");
        AudioScriptGUI.DrawList(serializedObject.FindProperty("CloseEvents"));
        serializedObject.ApplyModifiedProperties();
        Check();
    }

    void Check()
    {
        if (component.GetComponent<Dropdown>() == null)
        { 
            EditorGUILayout.HelpBox("Can't Find Dropdown Component !", UnityEditor.MessageType.Error);
        }
    }
}